package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.entity.DishFlavor;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author by 孙有泽
 * @Date 2025/2/28 11:32
 * @Description
 */
@Mapper
public interface DishMapper {
    /*
     * @author 孙有泽
     * @date 2025/2/28 11:33
     * @description 根据菜品分类id查询菜品数量
     */
    Integer selectCountByCategoryId(@Param("categoryId") Long categoryId);

/*
     * @author 孙有泽
     * @date 2025/2/28 11:33
     * @description 新增菜品
     */
    @AutoFill(OperationType.INSERT)
    void insert(@Param("dish") Dish dish);
    /*
     * @author 孙有泽
     * @date 2025/3/3 17:34
     * @description 菜品列表
     */
    Page<DishVO> list(DishPageQueryDTO dishPageQueryDTO);
    /*
     * @author 孙有泽
     * @date 2025/3/3 18:11
     * @description 根据id查询菜品
     */

     Dish selectStatusById(@Param("id") Long id);
    /*
     * @author 孙有泽
     * @date 2025/3/3 18:19
     * @description 删除菜品
     */
    void deleteById(@Param("id") Long id);

    @AutoFill(OperationType.UPDATE)
    void update(@Param("dish") Dish dish);

    Dish getById(@Param("id") Long id);

    List<DishVO> selectDishByCategoryId(@Param("categoryId") Long categoryId);
    @Select("select * from dish where category_id = #{categoryId} and status = #{status}")
    List<Dish> listDish(Dish dish);
}
